package com.test.homwork3;

public class LetterPrinter extends Thread{
    private Printer p;

    @Override
    public void run() {
        synchronized (p){
            for (char c = 'A';c<='Z';c++){
                try {
                    p.print(c);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        }
    }

    public LetterPrinter(Printer p) {
        this.p = p;
    }
}
